package cn.semyes.ylipfilter.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.semyes.ylipfilter.dao.custom.BusinessBridgeDao;
import cn.semyes.ylipfilter.entity.BusinessBridgeEntity;
import cn.semyes.ylipfilter.service.BusinessBridgeService;


@Service
public class BusinessBridgeServiceImpl implements BusinessBridgeService {
	
	
	@Autowired
	private BusinessBridgeDao businessBridgeDao;
	
	private BusinessBridgeEntity businessBridgeEntity;

	@Override
	public void saveUser(int user_id,String company_name, String phone_number, String create_time, int app_id,  String visit_time) {
		// TODO Auto-generated method stub
		businessBridgeEntity = new BusinessBridgeEntity();
		
		businessBridgeEntity.setUser_id(user_id);
		businessBridgeEntity.setCompany_name(company_name);
		businessBridgeEntity.setPhone_number(phone_number);
		businessBridgeEntity.setCreate_time(create_time);
		businessBridgeEntity.setApp_id(app_id);
		businessBridgeEntity.setVisit_time(visit_time);
		businessBridgeEntity.setCount_visit(1);
		businessBridgeDao.save(businessBridgeEntity);
	}

	@Override
	public int updateUser(String company_name, String phone_number) {
		// TODO Auto-generated method stub
		businessBridgeEntity = new BusinessBridgeEntity();
		businessBridgeEntity.setCompany_name(company_name);
		businessBridgeEntity.setPhone_number(phone_number);
		return businessBridgeDao.update(businessBridgeEntity);
	}

}
